package com.umeox.iqibla.qimi_app.ai_image

import android.text.TextUtils
import com.airbnb.lottie.LottieAnimationView

abstract class AbsAiImage {

    fun show(lottieAnimationView: LottieAnimationView, aiExpression: AIExpression) {
        val lottieJsonFileName = getLottieJsonFileNameByAIExpression(aiExpression)
        if (!TextUtils.isEmpty(lottieJsonFileName)) {
            lottieAnimationView.setAnimation(lottieJsonFileName)
            lottieAnimationView.playAnimation()
        }
    }

    private fun getLottieJsonFileNameByAIExpression(aiExpression: AIExpression): String {
        return when (aiExpression) {
            AIExpression.HELLO -> showHello()
            AIExpression.ANALYSIS -> showAnalysis()
            AIExpression.LISTENING -> showListening()
            AIExpression.SPEAK -> showSpeak()
        }
    }

    protected abstract fun showHello(): String

    protected abstract fun showAnalysis(): String

    protected abstract fun showListening(): String

    protected abstract fun showSpeak(): String
}